/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.code.server2client;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import java.io.Serializable;
import java.util.List;

/**
 *
 * @author dragon
 * @param <T>
 */
public class PageData<T> implements Serializable {


    private long totalRows;
    private int maxNum;
    private int currentPage;
    private boolean moreRows;

    private List<T> dataList;
    
    @Override
    public String toString(){
        return EnCode();
    }

    public String EnCode() {
        return JSON.toJSONString(this, SerializerFeature.WriteClassName,SerializerFeature.WriteEnumUsingName,SerializerFeature.WriteDateUseDateFormat);
    }

    public PageData<T> Decode(String str) {
        return JSON.parseObject(str, PageData.class);
    }

    public long getTotalRows() {
        return totalRows;
    }

    public void setTotalRows(long totalRows) {
        this.totalRows = totalRows;
    }

    public int getMaxNum() {
        return maxNum;
    }

    public void setMaxNum(int maxNum) {
        this.maxNum = maxNum;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public boolean isMoreRows() {
        return moreRows;
    }

    public void setMoreRows(boolean moreRows) {
        this.moreRows = moreRows;
    }

    public List<T> getDataList() {
        return dataList;
    }

    public void setDataList(List<T> dataList) {
        this.dataList = dataList;
    }

}
